# Maintainer:

pkgname=meson-python
pkgver=0.13.1
pkgrel=2
pkgdesc='Meson PEP 517 Python build backend'
arch=(any)
url='https://github.com/mesonbuild/meson-python'
license=(MIT)
depends=(meson patchelf python-wheel python-pyproject-metadata)
makedepends=(python-build python-installer ninja)
checkdepends=(python-pytest python-gitpython python-pytest-mock cython)
source=(https://github.com/mesonbuild/meson-python/archive/$pkgver/$pkgname-$pkgver.tar.gz)
sha256sums=('1637fc6b69b0b3152f5998fa0a6acfb4733c6ec246ea1e811e75e9ba8a53a64c')

prepare() {
  cd $pkgname-$pkgver
  sed -e '/ninja/d' -i pyproject.toml
}

build() {
  cd $pkgname-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $pkgname-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
# https://github.com/mesonbuild/meson-python/issues/397
  test-env/bin/python -m pytest -k 'not test_user_args'
}

package() {
  cd $pkgname-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}
